<# # It is recommended to test the script on a local machine for its purpose and effects. # ManageEngine Endpoint Central will not be responsible for any # damage/loss to the data/setup based on the behavior of the script. # Description: Script is designed to Fetch Event ID Details # Configuration Type - COMPUTER #> # Specify the event ID to filter (Hardcode the Event ID here) $eventID = 2 # Retrieve events from all available event logs $eventLogs = Get-WinEvent -ListLog * -ErrorAction SilentlyContinue $eventFound = $false $eventLogs | ForEach-Object { $events = Get-WinEvent -LogName $_.LogName -FilterXPath "*[System/EventID=$eventID]" -ErrorAction SilentlyContinue # Check if any events were found if ($events) { $eventFound = $true Write-Host "Event $eventID exists in log $($_.LogName)" } } if (-not $eventFound) { Write-Host "Event $eventID does not exist in any log." }